const getters = {
  // sidebar: state => state.app.sidebar,
  // device: state => state.app.device,
  // permission_routers: state => state.permission.routers,
  // addRouters: state => state.permission.addRouters,
  // permission_roles: state => state.permission.addRoles
  token: state => state.user.token,
  avatar: state => state.user.avatar,
  name: state => state.user.name,
  roles: state => state.user.roles,
  searchList: state => state.user.searchList,
  searchWord: state => state.user.searchWord,
  carList:state =>  {
     // 初始化全选状态
     if(state.all_selsect){
      state.carts.cart.forEach((item)=>{
          item.selected=true
      })
    }

    //列表变化存本地
    localStorage.setItem("cart",JSON.stringify(state.carts.cart)); 
    return state.carts.cart
  },
  allMoney:state =>{
    let all_money=0
    state.carts.cart.forEach((item)=>{
        if(item.selected){
            all_money+=item.numbers*item.sellPrice
        }
    })
    return state.all_money=all_money
  }
}
export default getters
